package d03_threadpool_executors;
/**
 * Start和run的联系，sleep和wait
 *
 */

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Test {
    public static void main(String[] args) {
        ScheduledExecutorService pool2= Executors.newScheduledThreadPool(2);

        pool2.schedule(()->{
            int sum=0;
            for (int i = 0; i < 10; i++) {
                sum+=i;
                System.out.println("累加"+1);
            }
            System.out.println("sum="+sum);
        },10, TimeUnit.SECONDS);
    }

}
